<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/pages/common/header.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Transport Billing System</title>

<script type="text/javascript" src="${jsContext}/utility.js"></script>
<script>
var elemArr = [];
	//Select all checkboxes
	function chooseAll() {
		var chkAll = document.getElementsByName("chkAll");
			
		var chk_arr = document.getElementsByName("chk");
		var chklength = chk_arr.length;
		if(chkAll[0].checked){
			for (count = 0; count < chklength; count++) {
				//if(chk_arr[count].checked==true)
					//chk_arr[count].checked = false;
				//else if(chk_arr[count].checked==false)
					chk_arr[count].checked = true;
			}
		}else{
			for (count = 0; count < chklength; count++) {
				chk_arr[count].checked = false;
			}
		}
		
	}

	// Prepare array of IDs to be submitted
	function submitSelectedRecords() {
		var isConfirm = confirm("Are You Sure to submit records?");
		if (isConfirm) {
			isConfirm=false;
			var table = $("excelInfo").DataTable();
			var data = table.$('input, select').serialize();
			var data = table.$('input, checkbox').serialize();
			var chk_arr = document.getElementsByName("chk");
			var chklength = chk_arr.length;
			var index = 0;
			for ( var count = 0; count < chklength; count++) {
				if (chk_arr[count].checked == true) {
					elemArr[index] = chk_arr[count].id;
					isConfirm=true;
					index++;
				}
			}
			if(!isConfirm){
				alert("Please select Atleast Only one");
				return isConfirm;
			}
			var elem = document.getElementById("challan1Ids");
			elem.value=elemArr;
		}
		return isConfirm;
	}
</script>
</head>
<body class="mainbody">
	<div class="mainContainer">
		<section class="bodyContainer">

		<form id="billTableForm" action="${context}/challan1" method="post">
			<div id="unBilled" class="productReport  hideClass">
				<h2 class="titleTxtBig">UnBilled Report</h2>
				<p class="hrlineBr"></p>

				<div class="productDtls">
					<p class="spacerTopTen"></p>

					<div class="divclear autoTableWith">
						<table cellpadding="0" cellspacing="0" border="0"
							class="display reportTable" id="excelInfo" style="width: 961px"
							name="masterTable">
							<thead>
								<tr>
									<th><input type="checkbox" id="chkAll"
										name="chkAll" onclick="chooseAll();" /></th>
									<th>S.No.</th>
									<th>SLIP NO</th>
									<th>TRUCK NO</th>
									<th>SUB TRANSPORTER NAME</th>
									<th>IN W.B. NO.</th>

									<th>IN W.B. USER</th>
									<th>IN DATE</th>
									<th>IN TIME</th>
									<th>TARE WEIGHT</th>
									<th>OUT W.B. NO.</th>

									<th>OUT W.B. USERIN DATE</th>
									<th>OUT DATE</th>
									<th>OUT TIME</th>
									<th>GROSS WEIGHT</th>
									<th>NET WEIGHT</th>

									<th>INVOICE NO.</th>
									<th>ROYALTY TYPE</th>
									<th>ROYALTY PASS NO.</th>
									<th>EXCISE AMOUNT</th>
									<th>EDU.CESS AMOUNT</th>

									<th>HSECESS AMOUNT</th>
									<th>CLEAN ENG.CESS AMOUNT</th>
									<th>ROYALTY AMOUNT</th>
									<th>BAL. ROYALTY AMOUNT</th>
									<th>IN W.B. NO.</th>

									<th>IN W.B. USER</th>
									<th>IN DATE</th>
									<th>IN TIME</th>
									<th>GROSS WEIGHT</th>
									<th>OUT W.B. NO.</th>

									<th>OUT W.B. USER</th>
									<th>OUT DATE</th>
									<th>OUT TIME</th>
									<th>TARE WEIGHT</th>
									<th>NET WEIGHT</th>

									<th>DUMP LOCATION</th>

								</tr>
							</thead>
							<tbody>
								<c:if test="${data ne null && not empty data}">
									<c:forEach var="record" items="${data}" varStatus="count">
										<tr>
											<td><input type="checkbox" id="${record.masterId}"
												name="chk" /></td>
											<td>${count.index+1}</td>
											<td>${record.slipNo}</td>
											<td>${record.truckNo}</td>
											<td>${record.subTransporterName}</td>
											<td>${record.vmsInWbNo}</td>

											<td>${record.vmsInWbUser}</td>
											<td>${record.vmsInDate}</td>
											<td>${record.vmsInTime}</td>
											<td>${record.vmsTareWeight}</td>
											<td>${record.vmsOutWbNo}</td>

											<td>${record.vmsOutWbUser}</td>
											<td>${record.vmsOutDate}</td>
											<td>${record.vmsOutTime}</td>
											<td>${record.vmsGrossWeight}</td>
											<td>${record.vmsTotalWeight}</td>

											<td>${record.invoiceNo}</td>
											<td>${record.royalityType}</td>
											<td>${record.royalityPassNo}</td>
											<td>${record.exciseAmount}</td>
											<td>${record.eduCessAmount}</td>

											<td>${record.hseCessAmount}</td>
											<td>${record.cleanEngCessAmount}</td>
											<td>${record.royalityAmount}</td>
											<td>${record.balRoyalityAmount}</td>
											<td>${record.vsInWbNo}</td>

											<td>${record.vsInWbUser}</td>
											<td>${record.vsInDate}</td>
											<td>${record.vsInTime}</td>
											<td>${record.vsGrossWeight}</td>
											<td>${record.vsOutWbNo}</td>

											<td>${record.vsOutWbUser}</td>
											<td>${record.vsOutDate}</td>
											<td>${record.vsOutTime}</td>
											<td>${record.vsTareWeight}</td>
											<td>${record.vsNetWeight}</td>

											<td>${record.dumpLocation}</td>
										</tr>
									</c:forEach>
								</c:if>
							</tbody>
						</table>
					</div>
					<p class="spacerTopTen"></p>
					<p class="hrlineBr"></p>

					<p class="spacerTopTen"></p>
					<p class="spacerTopTen"></p>
					<div class="divclear">
						<span class="buttonSiyora button80"><input type="submit"
							value="Submit" onClick=" return submitSelectedRecords();" /> </span>
					</div>
					<p class="spacerTopTen"></p>
					<p class="spacerTopTen"></p>
					<p class="spacerTopTen"></p>
				</div>
			</div>
			<input type="hidden" name="challan1Ids" id="challan1Ids" />
			<input type="hidden" name="ACTION" value="FRSC">
		</form>

		</section>
	</div>
	<jsp:include page="/pages/common/footer.jsp" />
</body>
</html>
